跳到主要内容

Linux ifconfig 命令

配置网络

# 为网卡配置和删除 IPv6 地址
ifconfig ens33 add 75eg:2650:800:35cv::2/64 #配置IPv6地址
ifconfig ens33 del 75eg:2650:800:35cv::2/64 #删除IPv6地址

启动关闭指定网卡

使用 ssh 登陆 linux 服务器操作要小心,关闭了就不能开启了,除非你有多网卡,否则你将无法通过 ssh 远程登录到此主机。

ifconfig ens33 up    #启动网卡
ifconfig ens33 down #关闭网卡

快速配置网络

ifconfig ens33:1 192.168.18.103 netmask 255.255.255.0 up
ifconfig ens33:2 192.168.18.104 netmask 255.255.255.0 up

References

每天学一个 Linux 命令(64):ifconfig